import { ComponentMetadata, Snippet } from '@alilc/lowcode-types';

const StationEquipmentSummaryMeta: ComponentMetadata = {
  componentName: 'StationEquipmentSummary',
  title: '站体设备汇总',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  group: '设施环境',
  category: '数据展示',
  priority: 0,
  npm: {
    package: 'hzdz-charts',
    version: '0.1.0',
    exportName: 'StationEquipmentSummary',
    main: 'src/index.tsx',
    destructuring: true,
    subName: '',
  },
  configure: {
    props: [
      {
        title: '基础配置',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'title',
            title: '组件标题',
            setter: 'StringSetter',
            defaultValue: '站体设备汇总',
          },
          {
            name: 'englishTitle',
            title: '英文标题',
            setter: 'StringSetter',
            defaultValue: 'Station equipment integration',
          },
        ],
      },
      {
        title: '消防设备配置',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'fireEquipment',
            title: '消防设备',
            setter: {
              componentName: 'ArraySetter',
              props: {
                itemSetter: {
                  componentName: 'ObjectSetter',
                  props: {
                    config: {
                      items: [
                        {
                          name: 'icon',
                          title: '图标',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'label',
                          title: '标签',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'value',
                          title: '数值',
                          setter: 'NumberSetter',
                        },
                      ],
                    },
                  },
                },
              },
            },
            defaultValue: [
              { icon: 'http://localhost:8085/static/images/sheshihuanjing/01(1).png', label: '微型消防站', value: 21 },
              { icon: 'http://localhost:8085/static/images/sheshihuanjing/02.png', label: '消防车', value: 21 },
            ],
          },
        ],
      },
      {
        title: '设备表格配置',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'equipmentTable',
            title: '设备表格数据',
            setter: {
              componentName: 'ArraySetter',
              props: {
                itemSetter: {
                  componentName: 'ObjectSetter',
                  props: {
                    config: {
                      items: [
                        {
                          name: 'key',
                          title: '唯一标识',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'name',
                          title: '设备名称',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'count',
                          title: '数量',
                          setter: 'NumberSetter',
                        },
                        {
                          name: 'status',
                          title: '状态',
                          setter: 'StringSetter',
                        },
                      ],
                    },
                  },
                },
              },
            },
            defaultValue: [
              { key: '1', name: '推车式干煤灭火器', count: 5, status: '0' },
              { key: '2', name: '紧急报警器', count: 7, status: '0' },
            ],
          },
        ],
      },
      {
        title: '气象设备配置',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'weatherStationCount',
            title: '微型气象站数量',
            setter: 'NumberSetter',
            defaultValue: 21,
          },
          {
            name: 'weatherPieData',
            title: '气象设备饼图数据',
            setter: {
              componentName: 'ArraySetter',
              props: {
                itemSetter: {
                  componentName: 'ObjectSetter',
                  props: {
                    config: {
                      items: [
                        {
                          name: 'name',
                          title: '名称',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'value',
                          title: '数值',
                          setter: 'NumberSetter',
                        },
                      ],
                    },
                  },
                },
              },
            },
            defaultValue: [
              { name: '温湿度监控仪', value: 30 },
              { name: '微型空气质量站', value: 25 },
              { name: '气象微站', value: 25 },
              { name: '路面状况监测仪', value: 20 },
            ],
          },
        ],
      },
      {
        title: '特种设备配置',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'specialEquipment',
            title: '特种设备',
            setter: {
              componentName: 'ArraySetter',
              props: {
                itemSetter: {
                  componentName: 'ObjectSetter',
                  props: {
                    config: {
                      items: [
                        {
                          name: 'icon',
                          title: '图标',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'label',
                          title: '标签',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'value',
                          title: '数值',
                          setter: 'NumberSetter',
                        },
                        {
                          name: 'hasBackground',
                          title: '是否有背景',
                          setter: 'BoolSetter',
                        },
                      ],
                    },
                  },
                },
              },
            },
            defaultValue: [
              { icon: 'http://localhost:8085/static/images/sheshihuanjing/编组33.png', label: '电梯', value: 40, hasBackground: true },
              { icon: 'http://localhost:8085/static/images/sheshihuanjing/编组34.png', label: '锅炉', value: 4, hasBackground: true },
            ],
          },
        ],
      },
      {
        title: '事件处理',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'onClick',
            title: '点击事件',
            setter: 'FunctionSetter',
          },
        ],
      },
      {
        title: '外观',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'style',
            title: '自定义样式',
            setter: 'StyleSetter',
          },
          {
            name: 'className',
            title: '自定义类名',
            setter: 'StringSetter',
          },
        ],
      },
    ],
    supports: {
      style: true,
      events: ['onClick'],
    },
    component: {},
  },
};

const snippets: Snippet[] = [
  {
    title: '站体设备汇总',
    screenshot: '',
    schema: {
      componentName: 'StationEquipmentSummary',
      props: {
        title: '站体设备汇总',
        englishTitle: 'Station equipment integration',
        fireEquipment: [
          { icon: 'http://localhost:8085/static/images/sheshihuanjing/01(1).png', label: '微型消防站', value: 21 },
          { icon: 'http://localhost:8085/static/images/sheshihuanjing/02.png', label: '消防车', value: 21 },
        ],
        equipmentTable: [
          { key: '1', name: '推车式干煤灭火器', count: 5, status: '0' },
          { key: '2', name: '紧急报警器', count: 7, status: '0' },
        ],
        weatherStationCount: 21,
        weatherPieData: [
          { name: '温湿度监控仪', value: 30 },
          { name: '微型空气质量站', value: 25 },
          { name: '气象微站', value: 25 },
          { name: '路面状况监测仪', value: 20 },
        ],
        specialEquipment: [
          { icon: 'http://localhost:8085/static/images/sheshihuanjing/编组33.png', label: '电梯', value: 40, hasBackground: true },
          { icon: 'http://localhost:8085/static/images/sheshihuanjing/编组34.png', label: '锅炉', value: 4, hasBackground: true },
        ],
      },
    },
  },
];

export default {
  ...StationEquipmentSummaryMeta,
  snippets,
};